import 'package:aichat_flutter_wallet/module/module_dapp/widgets/components/dapp_tip_com.dart';
import 'package:aichat_flutter_wallet/module_common/utils/colors.dart';
import 'package:aichat_flutter_wallet/module_common/widgets/image/public_image.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class DAppTopiItem extends StatelessWidget {
  String title;
  String image;
  String statement = '';
  Function onClick;

  DAppTopiItem(
      {super.key,
      required this.title,
      required this.image,
      this.statement = '',
      required this.onClick});

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return InkWell(
      overlayColor: MaterialStateProperty.resolveWith((states) {
        return Colors.transparent;
      }),
      onTap: () {
        onClick();
      },
      child: Container(
        width: 78.w,
        child: Stack(
          clipBehavior: Clip.none,
          children: [
            Container(
              width: double.infinity,
              alignment: Alignment.center,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  SizedBox(
                    height: 8.w,
                  ),
                  ClipRRect(
                    borderRadius: BorderRadius.circular(80.w),
                    child: PublicImage(
                      image: image,
                      width: 40.w,
                      height: 40.w,
                    ),
                  ),
                  // ),
                  SizedBox(
                    height: 3.w,
                  ),
                  Text(
                    title,
                    overflow: TextOverflow.ellipsis,
                    maxLines: 1,
                    style: TextStyle(
                      color: Color.fromRGBO(51, 51, 51, 1),
                      fontSize: 12.sp,
                      height: 17.w / 12.w,
                      fontWeight: FontWeight.w400,
                    ),
                  )
                ],
              ),
            ),
            if (statement.length > 0)
              Positioned(
                  left: 78.w / 2, top: 0, child: DappTips(title: statement)),
          ],
        ),
      ),
    );
  }
}
